﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="ManageSubLocations.aspx.cs" Inherits="Administration_ManageSubLocations"
    CodeFileBaseClass="BaseView" ViewName="ManageSubLocations" Title="Crux - Manage Sub Locations" %>

<%@ Register Src="../Controls/Common/WaterMarkedTextBox.ascx" TagName="WaterMarkedTextBox"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/ErrorNotification.ascx" TagName="ErrorNotification"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/ManagedEntityName.ascx" TagName="ManagedEntityName"
    TagPrefix="crux" %>
<%@ Register Src="../Controls/Common/AdditionalButtonsOnGrid.ascx" TagName="AdditionalButtonsOnGrid"
    TagPrefix="crux" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <!-- 
        CreativeToDo: The Text Boxes On This Page Don't Change Their BackGround Like Login Page 
             when Validations are not satified 
        -->
    <asp:UpdatePanel ID="updUpdate" runat="server">
        <ContentTemplate>
            <crux:ManagedEntityName ID="cruxLocationName" runat="server" PreceedingText="Your Are Currently Managing Location: "
                ShowEntityURL="true" EntityType="Location" />
            <table>
                <tr>
                    <td height="12">
                    </td>
                </tr>
            </table>
            <asp:Panel ID="pnlList" runat="server">
                <table cellpadding="0" cellspacing="0" class="toolbar">
                    <tr>
                        <td>
                            <asp:ImageButton ID="btnAddNewSubLocation" runat="server" OnClick="btnAddNewSubLocation_Click"
                                meta:resourcekey="btnAddNewSubLocationResource1" />
                            &nbsp;<input type="image" src="../appimages/back.gif" onclick="history.go(-1)" />
                        </td>
                    </tr>
                </table>
                <table>
                    <tr>
                        <td height="12">
                        </td>
                    </tr>
                </table>
                <asp:GridView ID="grdSubLocations" runat="server" OnRowDataBound="grdSubLocations_RowDataBound"
                    AutoGenerateColumns="False" AllowPaging="true" OnPageIndexChanging="PageIndexChanging">
                    <PagerTemplate>
                        <table border="0" cellpadding="0" cellspacing="0" align="center">
                            <tr>
                                <td class="pagerTabPadding">
                                    <table id="pagerOuterTable" class="pagerOuterTable" cellpadding="0" cellspacing="0"
                                        runat="server" align="center">
                                        <tr>
                                            <td>
                                                <table id="pagerInnerTable" cellpadding="2" cellspacing="0" runat="server">
                                                    <tr>
                                                        <td class="pageCounter">
                                                            <asp:Label ID="lblPageCounter" runat="server" Text=""></asp:Label>
                                                        </td>
                                                        <td class="pageFirstLast">
                                                            <asp:ImageButton ID="FirstPage" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/appimages/firstpage.gif"
                                                                CommandName="Page" CommandArgument="First" align="absmiddle" />&nbsp;<asp:LinkButton
                                                                    ID="lnkFirstPage" CssClass="pagerLink" runat="server" CommandName="Page" CommandArgument="First">First</asp:LinkButton>
                                                        </td>
                                                        <td class="pagePrevNextNumber">
                                                            <asp:ImageButton ID="imgPrevPage" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/appimages/prevpage.gif"
                                                                CommandName="Page" CommandArgument="Prev" />
                                                        </td>
                                                        <td class="pagePrevNextNumber">
                                                            <asp:ImageButton ID="imgNextPage" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/appimages/nextpage.gif"
                                                                CommandName="Page" CommandArgument="Next" />
                                                        </td>
                                                        <td class="pageFirstLast">
                                                            <asp:LinkButton ID="lnkLastPage" CssClass="pagerLink" CommandName="Page" CommandArgument="Last"
                                                                runat="server">Last</asp:LinkButton>&nbsp;<asp:ImageButton ID="LastPage" runat="server"
                                                                    ImageAlign="AbsMiddle" ImageUrl="~/appimages/lastpage.gif" align="absmiddle"
                                                                    CommandName="Page" CommandArgument="Last" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </PagerTemplate>
                    <Columns>
                        <asp:BoundField DataField="SubLocationID" HeaderText="SubLocation ID" ItemStyle-CssClass="GridFirstColumn" />
                        <asp:BoundField DataField="SubLocationName" HeaderText="SubLocation Name" />
                        <asp:BoundField DataField="SubLocationAddress" HeaderText="SubLocation Address" />
                        <asp:BoundField DataField="SubLocationComments" HeaderText="SubLocation Comments" />
                        <asp:TemplateField HeaderText="Actions" ItemStyle-CssClass="ActionButtons">
                            <ItemTemplate>
                                <center>
                                    <asp:ImageButton ID="btnItemEditIcon" runat="server" CausesValidation="false" CommandName="EditItem"
                                        OnCommand="grdSubLocations_RowCommand" CommandArgument='<%#Eval("SubLocationID")%>'
                                        ImageUrl="~/appimages/edit_sublocations.gif" ToolTip='<%# "Edit "  +Resources.Strings.SubLocationText + " Details" %>' />
                                    <asp:ImageButton ID="btnItemDelete" runat="server" CausesValidation="false" CommandName="DeleteItem"
                                        OnCommand="grdSubLocations_RowCommand" CommandArgument='<%#Eval("SubLocationID")%>'
                                        ImageUrl="~/appImages/delete.gif" ToolTip='<%# "Delete " + Resources.Strings.SubLocationText %>' />
                                    <asp:Panel runat="server" ID="pnlAdditionalConfigurationBasedButtons">
                                        <crux:AdditionalButtonsOnGrid  runat="server" ObjectID='<%#Eval("SubLocationID")%>'
                                            GridName="ManageSubLocations" />
                                    </asp:Panel>
                                </center>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </asp:Panel>
            <asp:Panel ID="pnlAddEdit" runat="server">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td class="formTxtHeader" colspan="2">
                            <%= Resources.Strings.SubLocationText %>
                        </td>
                    </tr>
                    <tr>
                        <td class="formLine" colspan="2">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>
                    <!-- Sub Location ID -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblSubLocationID" runat="server" Text='<%# Resources.Strings.SubLocationText + " ID:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <asp:Label ID="lblSubLocationIDValue" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- Sub Location Name -->
                    <tr>
                        <td align="right" valign="middle" class="formLeftColmnWidth">
                            <asp:Label ID="lblSubLocationName" runat="server" Text='<%# Resources.Strings.SubLocationText + " Name:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtSubLocationName" WaterMarkText="Sub Location Name"
                                ValueRequired="true" ErrorText="Sub Location Name is required." Width="180" MaxLength="50"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- Sub Location Address -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="lblSubLocationAddress" runat="server" Text='<%# Resources.Strings.SubLocationText + " Address:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtSubLocationAddress" WaterMarkText="Sub Location Address"
                                ValueRequired="false" TextMode="MultiLine" ErrorText="Sub Location Address is required."
                                Width="180" Height="30" MaxLength="200" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formFieldGap">
                        </td>
                    </tr>
                    <!-- Sub Location Comments -->
                    <tr>
                        <td align="right" valign="top" class="formLeftColmnWidth formPaddingTop">
                            <asp:Label ID="lblSubLocationComments" runat="server" Text='<%# Resources.Strings.SubLocationText + " Comments:"%>'
                                CssClass="formLabel"></asp:Label>
                        </td>
                        <td align="left" valign="middle" class="formRightColmnWidth">
                            <crux:WaterMarkedTextBox ID="txtSubLocationComments" WaterMarkText="Sub Location Comments"
                                ValueRequired="false" MaxLength="10" TextMode="MultiLine" Width="180" Height="30"
                                runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="formGroupGap">
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td colspan="2" align="left">
                            <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />
                            &nbsp;
                            <asp:Button ID="btnCancel" CausesValidation="false" runat="server" Text="Cancel"
                                OnClick="btnCancel_Click" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <crux:ErrorNotification ID="pnlError" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
